package main.chapter7.io

import java.io.BufferedReader
import java.io.File
import java.io.FileReader

fun main() {
    val file = File("src/main/chapter7/io/ioTestFile.txt")
    //use会自动关闭
    BufferedReader(FileReader(file)).use {
        var line: String
        while (true) {
            line = it.readLine() ?: break
            println(line)
        }
    }
}